/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package presentation.proportional;

import entity.xml.EUtente;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;

/**
 *
 * @author Quirino
 */
public class PanelRubricaContact extends JPanel{

    private JLayeredPane wrapperUser= null;
    private JLabel polaroidUser= null;
    private JLabel avatarUser= null;
    private JLabel nicknameUser= null;
    private JLabel checkUser= null;
    //private JPanel bckCheckUser= null;
    private int widthBacheca= 0;
    private int heightBacheca= 0;
    
    public PanelRubricaContact(EUtente eUser) {
        
        this.widthBacheca= Utility.getDimensionBacheca().width;
        this.heightBacheca= Utility.getDimensionBacheca().height;
        
        this.setOpaque(false);
        
        this.paintPanelContact(eUser);
        
    }
    
    public void paintPanelContact(EUtente eUser){
        
        this.wrapperUser= new JLayeredPane();
        this.wrapperUser.setPreferredSize(new Dimension((int)(widthBacheca/7),(int)(heightBacheca/3)));
        this.wrapperUser.setBounds((int)(widthBacheca/18), 0, (int)(widthBacheca/7), (int)(heightBacheca/3));
        this.wrapperUser.setOpaque(false);
        
        ImageIcon minIcon= Utility.getResizedImageIcon("polaroid.png", (int)(widthBacheca/7), (int)(heightBacheca/3));
        this.polaroidUser= new JLabel(minIcon);
        this.polaroidUser.setPreferredSize(new Dimension((int)(widthBacheca/7),(int)heightBacheca/3));
        this.polaroidUser.setBounds(0,0,(int)(widthBacheca/7),(int)(heightBacheca/3));
        this.polaroidUser.setOpaque(false);
        wrapperUser.add(this.polaroidUser, new Integer(0));
        
        ImageIcon avatar= Utility.getResizedImageIcon(eUser.getAvatar(), (int)(widthBacheca/7.7), (int)(heightBacheca/3.7));
        this.avatarUser= new JLabel(avatar);
        this.avatarUser.setPreferredSize(new Dimension((int)(widthBacheca/7.7),(int)(heightBacheca/3.7)));
        this.avatarUser.setBounds((int)(polaroidUser.getWidth()/22), (int)(polaroidUser.getHeight()/25), (int)(widthBacheca/7.7),(int)(heightBacheca/3.7));
        this.avatarUser.setOpaque(false);
        wrapperUser.add(this.avatarUser, new Integer(1));
        
        this.nicknameUser= new JLabel(eUser.getNickname());
        this.nicknameUser.setForeground(Color.black);
        this.nicknameUser.setPreferredSize(new Dimension((int)(widthBacheca/7.7),(int)(heightBacheca/20)));
        this.nicknameUser.setBounds((int)(polaroidUser.getWidth()/22), (int)(polaroidUser.getHeight()/1.2), (int)(widthBacheca/7.7),(int)(heightBacheca/20));
        this.nicknameUser.setHorizontalAlignment(JLabel.CENTER);
        this.nicknameUser.setOpaque(false);
        wrapperUser.add(this.nicknameUser, new Integer(2));
        
        /*
        this.bckCheckUser= new JPanel();
        this.bckCheckUser.setPreferredSize(new Dimension((int)(widthBacheca/7),(int)heightBacheca/3));
        this.bckCheckUser.setBounds(0,0,(int)(widthBacheca/7),(int)(heightBacheca/3));
        this.bckCheckUser.setOpaque(true);
        this.bckCheckUser.setBackground(new Color (0, 0, 0, 64));
        this.bckCheckUser.setVisible(false);
        wrapperUser.add(this.bckCheckUser, new Integer(3));
        */
        
        ImageIcon checkIcon= Utility.getResizedImageIcon( "check_icon.png", (int)(widthBacheca/20), (int)(heightBacheca/15));
        this.checkUser= new JLabel(checkIcon);
        this.checkUser.setPreferredSize(new Dimension((int)(widthBacheca/20),(int)(heightBacheca/15)));
        this.checkUser.setBounds((int)(polaroidUser.getWidth()/100), (int)(polaroidUser.getHeight()/1.25), (int)(widthBacheca/20),(int)(heightBacheca/15));
        this.checkUser.setOpaque(false);
        this.checkUser.setVisible(false);
        wrapperUser.add(this.checkUser, new Integer(4));
        
        this.add(this.wrapperUser);
        
    }
    
    public void signAsChecked(){
        //this.bckCheckUser.setVisible(true);
        this.checkUser.setVisible(true);
    }
    
    public void signAsUnchecked(){
        //this.bckCheckUser.setVisible(false);
        this.checkUser.setVisible(false);
    }
    
    public int getHeightBacheca() {
        return heightBacheca;
    }

    public void setHeightBacheca(int heightBacheca) {
        this.heightBacheca = heightBacheca;
    }

    public int getWidthBacheca() {
        return widthBacheca;
    }

    public void setWidthBacheca(int widthBacheca) {
        this.widthBacheca = widthBacheca;
    }

    public JLayeredPane getWrapperUser() {
        return wrapperUser;
    }

    public void setWrapperUser(JLayeredPane wrapperUser) {
        this.wrapperUser = wrapperUser;
    }

    public JLabel getAvatarUser() {
        return avatarUser;
    }

    public void setAvatarUser(JLabel avatarUser) {
        this.avatarUser = avatarUser;
    }

    public JLabel getNicknameUser() {
        return nicknameUser;
    }

    public void setNicknameUser(JLabel nicknameUser) {
        this.nicknameUser = nicknameUser;
    }

    public JLabel getPolaroidUser() {
        return polaroidUser;
    }

    public void setPolaroidUser(JLabel polaroidUser) {
        this.polaroidUser = polaroidUser;
    }
    
    
    
}
